﻿@model smartcrm.Models.ContactList 

<script src="../../Scripts/contact.js"></script>
<form method="post" action="/Contact/Index">
<div class="divSearch">
    <table>
        <tr>
            <td class="label">客户</td>
            <td>@Html.DropDownList("sCustomerNo", new SelectList(Model.DdlCustomer, "ItemValue", "ItemText"))</td>
            <td class="label">关键字</td>
            <td> @Html.TextBox("Keywords", null, new { maxlength = "50" })&nbsp;&nbsp;<input type="submit" id="btnSearch" value="搜索" /> </td>
        </tr>
    </table>    
</div>
</form>
@{
    smartcrm.Models.LoginUser user = Session["LoginUser"] as smartcrm.Models.LoginUser;
}

@if (user.PermissionList.Contains("P0104"))
{
    <div class="FR">
        <input type="button" value="新增" id="btnNew" /><input type="button" value="返回" style="display :@Model.backButtonVisibility" id="btnGoback" onclick="javascript:history.go(-1);" />     
    </div>
}
<div class="list">
<table id="tContact">
<thead>
<tr>
<th>联系人姓名</th>
<th>所属客户</th>
<th>座机</th>
<th>手机</th>
<th>Email</th>
<th>QQ</th>
<th>其它</th>
<!-- <th>快速索引</th> -->
<th>操作</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Contacts)
        {
            <tr id="@item.ContactNo">
                <td style="width:12%">@Html.DisplayFor(modelItem => item.ContactName)</td>
                <td style="width:12%">@Html.DisplayFor(modelItem => item.CustomerNo)</td>
                <td style="width:15%">@Html.DisplayFor(modelItem => item.Phone)</td>
                <td style="width:10%">@Html.DisplayFor(modelItem => item.Mobile)</td>
                <td style="width:10%">@Html.DisplayFor(modelItem => item.Email)</td>      
                <td style="width:10%">@Html.DisplayFor(modelItem => item.QQ)</td>       
                <td>@Html.DisplayFor(modelItem => item.Other)</td>       
                <!-- <td>@Html.DisplayFor(modelItem => item.SearchKey)</td> -->
                <td style="width:6%">
                @if (user.PermissionList.Contains("P0105"))
                {
                    <img src="../../Images/grid/edit.png" title="编辑" onclick="javascript:return EditContact('@item.ContactNo')" />
                }
                @if (user.PermissionList.Contains("P0106"))
                {
                    <img src="../../Images/grid/delete.png" title="删除"  onclick="javascript:return DeleteContact('@item.ContactNo')" />                
                }
                </td>
            </tr>
        }
</tbody>
</table>
@Html.Pager("Index", "Contact", Model.RouterDirectory, Model.PagerConfig, "pagerDiv", "pagerDiv", 8,true, false, true, true,false)
</div>

<div id="divContact" title="联系人信息" style="display:none">      
    <div id="divContactContent" style="overflow-y: auto; height: 280px;">          
        @using (Html.BeginForm())
        {
            <table id="tableEdit" class="font85 tableEdit">
                <tr>
                    <td class="label">所属客户</td>
                    <td>
                        @Html.DropDownList("CustomerNo", new SelectList(Model.DdlCustomer, "ItemValue", "ItemText"))&nbsp;<span class="redStar">*</span>
                        @Html.Hidden("ContactNo")                      
                    </td>
                </tr>
                <tr>
                    <td class="label">姓名</td>
                    <td>
                        @Html.TextBox("ContactName", null, new { maxlength = "50" })&nbsp;<span class="redStar">*</span>                                           
                    </td>
                </tr>
                <tr>
                    <td class="label">座机</td>
                    <td>
                        @Html.TextBox("Phone", null, new { maxlength = "50" })                       
                     </td>
                </tr>
                <tr>
                    <td class="label">手机</td>
                    <td>
                        @Html.TextBox("Mobile", null, new { maxlength = "50" })
                     </td>
                </tr>  
                <tr>
                    <td class="label">Email</td>
                    <td>
                        @Html.TextBox("Email", null, new { maxlength = "50" })
                     </td>
                </tr> 
                <tr>
                    <td class="label">QQ</td>
                    <td>
                        @Html.TextBox("QQ", null, new { maxlength = "50" })
                     </td>
                </tr>       
                <tr>
                    <td class="label">其它</td>
                    <td>
                        @Html.TextBox("Other", null, new { maxlength = "50" })
                     </td>
                </tr>                 
               <!-- <tr>
                    <td class="label">快速索引</td>
                     <td>@Html.TextBox("SearchKey", null, new { maxlength = "100"})                 
                     </td>
                </tr> -->                  
            </table> 
            <br />                     
        }
    </div>  
    <div style="text-align:right;">  
        <span id="errorMessage" class="errorSpan"></span>  
       <input type="button" id="btnSave" value="保存" />
       <input type="button" id="btnCancel" value="取消" />    
    </div>  
</div>  
